/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package webidewar.system;

import com.icesoft.faces.async.render.OnDemandRenderer;
import java.io.IOException;
import java.io.InputStream;

/**
 *
 * @author huy
 */
public class AjaxInputStream extends InputStream {

    private OnDemandRenderer renderer;
    private inout io;

    public inout getIo() {
        return io;
    }

    public void setIo(inout io) {
        this.io = io;
    }

    public AjaxInputStream(inout _io, OnDemandRenderer _renderer) {
        setIo(_io);
        renderer = _renderer;
    }

    @Override
    public int read() throws IOException {
        int i = io.nextInputByte();
        //System.out.println(">>>next>>>"+(char)i);
        //if (i == 13) {
        //    
        //    renderer.requestRender();
        //    return -1;
        //}
        return i;

    }
}
